﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo6
{
    // 定义类 ：  访问修饰符  class 类名
    public class Animal
    {
        // 字段 保存数据 
        private double length;   // 体长
        private double weight;  // 体重

        // 定义属性对字段进行访问控制  读写
        public double Length
        {
            get
            {
                return length;
            }
            set
            {
                length = value;
            }
        }
        public double Weight
        {
            get
            {
                return weight;
            }
            set
            {
                weight = value;
            }
        }

        public Animal()
        {
            Console.WriteLine("我是一只野兽！");
        }
    }


    class Program
    {
        static void Main(string[] args)
        {
            Animal lion = new Animal();
            lion.Length = 3.0;
            lion.Weight = 2.0;
            Console.WriteLine($"这个野兽长{lion.Length}米,重{lion.Weight}吨");

            Console.ReadKey();
        }
    }
}
